package hz.mobileproject.pda.ui.activity.demo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;

import cn.droidlover.xdroidmvp.mvp.XActivity;
import cn.droidlover.xdroidmvp.router.Router;
import hz.mobileproject.pda.R;
import hz.mobileproject.pda.entity.response.Response_loadPrisonerList;
import hz.mobileproject.pda.callroll.presenter.PCalroll;
import hz.mobileproject.pda.ui.activity.SimpleScannerActivity;

public class Tools_demoActivity extends XActivity<PCalroll> {

    private RecyclerView mRecyclerView;
    private Tools_demo_Adapter mAdapter;
    private LinearLayoutManager mLayoutManager;
    private Button bt_scan;


    public static void launch(Activity activity) {
        Router.newIntent(activity)
                .to(Tools_demoActivity.class)
                .launch();
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


    }

    @Override
    public void onWidgetClick(View view) {

    }

    @Override
    public void initData(Bundle savedInstanceState) {

        mRecyclerView = (RecyclerView)findViewById(R.id.my_recycler_view);
        bt_scan = (Button)findViewById(R.id.bt_scan);
        mLayoutManager = new LinearLayoutManager(this);
        mRecyclerView.setLayoutManager(mLayoutManager);
//如果可以确定每个item的高度是固定的，设置这个选项可以提高性能
        mRecyclerView.setHasFixedSize(true);

        Response_loadPrisonerList  lists1=   new Response_loadPrisonerList();
        lists1.setPrisoner_name("剪刀");
        lists1.setPrisoner_id("001235213");
        Response_loadPrisonerList  lists2=   new Response_loadPrisonerList();
        lists2.setPrisoner_name("剪刀");
        lists2.setPrisoner_id("001235213");
        Response_loadPrisonerList  lists3=   new Response_loadPrisonerList();
        lists3.setPrisoner_name("剪刀");
        lists3.setPrisoner_id("002235213");
        Response_loadPrisonerList  lists4=   new Response_loadPrisonerList();
        lists4.setPrisoner_name("剪刀");
        lists4.setPrisoner_id("002635213");
        Response_loadPrisonerList  lists5=   new Response_loadPrisonerList();
        lists5.setPrisoner_name("梅花扳手");
        lists5.setPrisoner_id("891236613");
        Response_loadPrisonerList  lists6=   new Response_loadPrisonerList();
        lists6.setPrisoner_name("梅花扳手");
        lists6.setPrisoner_id("891232346");
        Response_loadPrisonerList  lists7=   new Response_loadPrisonerList();
        lists7.setPrisoner_name("梅花扳手");
        lists7.setPrisoner_id("891235213");
        Response_loadPrisonerList  lists8=   new Response_loadPrisonerList();
        lists8.setPrisoner_name("梅花扳手");
        lists8.setPrisoner_id("891232131");
        Response_loadPrisonerList  lists9=   new Response_loadPrisonerList();
        lists9.setPrisoner_name("钳工锤");
        lists9.setPrisoner_id("001235213");
        Response_loadPrisonerList  lists10=   new Response_loadPrisonerList();
        lists10.setPrisoner_name("钳工锤");
        lists10.setPrisoner_id("612353243");
        Response_loadPrisonerList  lists11=   new Response_loadPrisonerList();
        lists11.setPrisoner_name("钳工锤");
        lists11.setPrisoner_id("612354372");
        Response_loadPrisonerList  lists12=   new Response_loadPrisonerList();
        lists12.setPrisoner_name("台虎钳");
        lists12.setPrisoner_id("1001235298");
        Response_loadPrisonerList  lists13=   new Response_loadPrisonerList();
        lists13.setPrisoner_name("台虎钳");
        lists13.setPrisoner_id("1001235835");
        Response_loadPrisonerList  lists14=   new Response_loadPrisonerList();
        lists14.setPrisoner_name("台虎钳");
        lists14.setPrisoner_id("7501235215");
        Response_loadPrisonerList  lists15=   new Response_loadPrisonerList();
        lists15.setPrisoner_name("木工锯");
        lists15.setPrisoner_id("1051235217");
        Response_loadPrisonerList  lists16=   new Response_loadPrisonerList();
        lists16.setPrisoner_name("木工锯");
        lists16.setPrisoner_id("112352131");
        Response_loadPrisonerList  lists17=   new Response_loadPrisonerList();
        lists17.setPrisoner_name("电工刀");
        lists17.setPrisoner_id("101235213");
        Response_loadPrisonerList  lists18=   new Response_loadPrisonerList();
        lists18.setPrisoner_name("手摇钻");
        lists18.setPrisoner_id("10031235213");





        mAdapter = new Tools_demo_Adapter(getApplicationContext());
        mAdapter.addMsg(lists1);
        mAdapter.addMsg(lists2);
        mAdapter.addMsg(lists3);
        mAdapter.addMsg(lists4);
        mAdapter.addMsg(lists5);
        mAdapter.addMsg(lists6);
        mAdapter.addMsg(lists7);
        mAdapter.addMsg(lists8);
        mAdapter.addMsg(lists9);
        mAdapter.addMsg(lists10);
        mAdapter.addMsg(lists11);
        mAdapter.addMsg(lists12);
        mAdapter.addMsg(lists13);
        mAdapter.addMsg(lists14);
        mAdapter.addMsg(lists15);
        mAdapter.addMsg(lists16);
        mAdapter.addMsg(lists17);
        mAdapter.addMsg(lists18);
        mRecyclerView.setAdapter(mAdapter);

        bt_scan.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                startActivity(new Intent(Tools_demoActivity.this,SimpleScannerActivity.class));
            }
        });

    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_tools_demo;
    }

    @Override
    public PCalroll newP() {
        return new PCalroll(this);
    }
}
